package com.bytesizedhosting.api.android.darthcrap;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class FocusSolver implements View.OnFocusChangeListener {
	private Activity objActivity;
	
	public FocusSolver(Activity objActivity) {
		this.objActivity = objActivity;
	}

	public void onFocusChange(View objView, boolean boolHasFocus) {
		if (boolHasFocus == true) {
			InputMethodManager objManager = (InputMethodManager) this.objActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
			if (objManager != null) {
				objManager.hideSoftInputFromWindow(objView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
			}
		}
	}
}